<admintpl file="header" />
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a href="javascript:;">员工明细</a></li>
    </ul>
    <form class="well form-search" method="post" action="{:U('Member/index')}">
        <label for="exampleInputName2">总店列表</label>
        <select name="store_id" id="store_id">
            <option value="">请选择总店</option>
            <foreach name="storeList" item="s">
                <option value="{$s.store_id}" <if condition="$store_id eq $s['store_id']">selected</if>>{$s.store_name}</option>
            </foreach>
        </select>
        <label for="exampleInputName2">分店列表</label>
        <select name="store_parent_id" id="store_parent_id">
            <option value="">请选择分店</option>
            <foreach name="store_parentList" item="p">
                <option value="{$p.store_id}" <if condition="$store_parent_id eq $p['store_id']">selected</if>>{$p.store_name}</option>
            </foreach>
        </select>
        <label for="exampleInputName2">按成交数量排序</label>
        <select name="totalNumber">
            <option value="">请选择</option>
            <option value="asc"  <if condition="$totalNumber eq 'asc'">selected</if>>升序</option>
            <option value="desc" <if condition="$totalNumber eq 'desc'">selected</if>>降序</option>
        </select>
        <label for="exampleInputName2">按成交金额排序</label>
        <select name="totalTurnover">
            <option value="">请选择</option>
            <option value="asc"  <if condition="$totalTurnover eq 'asc'">selected</if>>升序</option>
            <option value="desc" <if condition="$totalTurnover eq 'desc'">selected</if>>降序</option>
        </select>
        <label for="exampleInputName2">按邀请人数排序</label>
        <select name="register_number">
            <option value="">请选择</option>
            <option value="asc"  <if condition="$register_number eq 'asc'">selected</if>>升序</option>
            <option value="desc" <if condition="$register_number eq 'desc'">selected</if>>降序</option>
        </select>

        <label for="exampleInputName2">用户名</label>
        <input type="text" class="form-control" id="exampleInputName2" placeholder="请输入用户名" name="user_name" value="{$user_name}">
        <br/><label for="exampleInputName2">开始时间</label>
        <input type="text" class="js-datetime" name="start_time" id="test16"  placeholder="点击选择开始时间" style="width: 180px;"  value="{$start_time}">
        <label for="exampleInputName2">结束时间</label>
        <input type="text" class="js-datetime" name="end_time" id="test17" placeholder="点击选择结束时间" style="width: 180px;"  value="{$end_time}">
        <input type="submit" class="btn btn-primary" value="搜索" />
        <a class="btn btn-danger" href="{:U('Member/index')}">清空</a>
        <div class="col-md-9">
            <label for="exampleInputName2">销售数据：</label>
            已成交数量：{$newArr.totalNumber|default=0}
            成交金额合计：{$newArr.totalTurnover|default=0}
        </div>
        <div class="col-md-9" >
            <label for="exampleInputName2">会员数据：</label>
            昨日新增会员:{$newArr.yesterdayCount|default=0}
            共新增会员：{$newArr.count|default=0}
            合计金额：{$newArr.totalSales|default=0}
        </div>
    </form>
    <table class="table table-hover table-bordered table-list">
        <thead>
        <tr>
            <th>ID</th>
            <th>员工手机号/员工名称</th>
            <th>员工手机号</th>
            <th>注册时间</th>
            <th>用户类型</th>
            <th>注册类型</th>
            <th>归属店铺</th>
            <!--<th>推荐人</th>-->
            <th>已邀请人数</th>
            <th>已成交数量</th>
            <th>已成交金额</th>
        </tr>
        </thead>
        <tbody>
        <php>
            $referType = array("0"=>'普通注册',"1"=>'分享注册',"2"=>'心愿单分享注册');
        </php>
        <foreach name="newArr['list']" item ="vo">
            <php>
                $referInfo = M("member")->where(array('user_id'=>$vo['referid']))->find();
            </php>
            <tr>
                <td>{$vo.user_id}</td>
                <td>{$vo.user_name}|{$vo.real_name}</td>
                <td>{$vo.phone_mob}</td>
                <td>{$vo.reg_time|date="Y-m-d H:i:s",###}</td>
                <td>
                    员工
                </td>
                <td>{$referType[$vo['refer_type']]}</td>
                <td>{$vo.s_name}</td>
                <!--<td>{$referInfo.user_name}|{$referInfo.real_name}</td>-->
                <td>{$vo.register_number}</td>
                <td>{$vo.totalNumber}</td>
                <td>{$vo.totalTurnover}</td>
            </tr>
        </foreach>
        </tbody>
    </table>
    <div class="pagination">{$page}</div>
</div>
<script src="__PUBLIC__/js/common.js"></script>
<script src="__PUBLIC__/layer/layer.js"></script>

<!-- iframe自适应高度 -->
</body>
<script type="text/javascript">

    $("#store_id").change(function(){
        var store_id = $(this).val();
        var url = "{:U('Member/getStore')}";
        if(store_id != ''){
            var str = '<option value="">请选择分店</option>'
            $.post(url,{
                store_id:store_id
            },function(data){
                var res = JSON.parse(data);
                if(res.length > 0){
                    $.each(res,function(index,item){
                        str += "<option value='"+item.store_id+"'>"+item.store_name+"</option>";
                    })
                }
                $("#store_parent_id").html(str);
            })
        }
    })
</script>

</html>
